package com.anivia.system.auth.controller.admin;

import com.anivia.common.core.model.vo.R;
import com.anivia.common.web.satoken.admin.SaAdminCheckLogin;
import com.anivia.system.auth.model.dto.UserInfoAddOrUpdateDTO;
import com.anivia.system.auth.service.IUserInfoService;
import io.swagger.v3.oas.annotations.Operation;
import io.swagger.v3.oas.annotations.tags.Tag;
import jakarta.annotation.Resource;
import jakarta.validation.Valid;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

/**
 * <p>
 * 用户基础信息 前端控制器
 * </p>
 *
 * @author wangj
 * @since 2024-04-02
 */
@Tag(name = "a端用户管理")
@RestController
@RequestMapping("admin/user")
public class UserInfoAdminController {
    @Resource
    private IUserInfoService userInfoService;

    @Operation(summary = "新增或更新用户")
    @PostMapping("saveOrUpdate")
    @SaAdminCheckLogin
    private R saveOrUpdate(@RequestBody @Valid UserInfoAddOrUpdateDTO dto) {
        userInfoService.addOrUpdate(dto);
        return R.ok();
    }
}
